#!/bin/bash

#命令行参数检测
if [ -n "$1" ];then
    echo "Source file: $1"
else
    echo "Usage:$0 <source_file>"
    exit -1
fi

sourcesfile=$1
if [[ -f $sourcesfile ]];then
    grep "\w\+[ ]\+\w\+([^()]*)[ ]*{\?$" $sourcesfile |grep -v "main" |sed -e 's/{\?$/;/' > "${sourcesfile%.*}.h"
fi
